<?php
namespace addons\prl\taglib;
use think\template\TagLib;
class Slide extends TagLib{
	/**
     * 定义标签列表
     */
    protected $tags   =  [
        'getslides'     => ['attr' => 'mark,limit,item', 'close' => 1], //轮播图获取 标识 条数
    ];

    /**
     * 轮播图
     */
    public function tagGetslides($tag, $content)
    {
    	$mark = empty($tag['mark']) ? '' : $tag['mark'];
        $limit = empty($tag['limit']) ? 5 : $tag['limit'];
        $item  = empty($tag['item']) ? 'vo' : $tag['item'];//循环变量名
        $parse = <<<parse
<?php
    \$__SLIDE_ITEMS__ = \addons\prl\service\Slides::getList('{$mark}',{$limit});
?>
{volist name="__SLIDE_ITEMS__" id="{$item}"}
{$content}
{/volist}
parse;
        return $parse;
    }
}